#define _CRT_SECURE_NO_WARNINGS 1

#include<string.h>
#include<stdio.h>



unsigned int my_strlen(const char* ch)
{
	const char* ch1 = ch;
	while (*ch != 0)
	{
		ch++;
	}
	return ch - ch1;
}

char* my_strcpy(char* ch, const char* ch1)
{
	char* ch2 = ch;
	while (*ch++ = *ch1++)
	{
		;
	}
	return ch2;
}

int my_strcmp(const char* ch1, const char* ch2)
{
	while (*ch1 == *ch2)
	{
		if (*ch1 == 0)
		{
			return 0;
		}
		ch1++;
		ch2++;
	}
	return *ch1 - *ch2;
}


char* my_strcat(char* ch1, const char* ch2)
{
	char* ch3 = ch1;
	while (*ch1 != 0)
	{
		ch1++;;
	}
	while (*ch1++ = *ch2++)
	{
		;
	}
	return ch3;
}
char* my_strstr(const char* ch1, const char* ch2)
{
	char* ch3 = ch1;
	char* ch4 = ch2;
	while (*ch1 != 0)
	{
		while(*ch1 != *ch2)
		{
			ch3++;
			ch1 = ch3;
			ch2 = ch4;
		}
		while(*ch1 == *ch2)
		{
			if (*ch2 == 0)
			{
				return ch3;
			}
			ch1++;
			ch2++;
		}
	}
	return NULL;
}
int main()
{
	char ch[20] = "hello world";
	char ch2[] = "world";
	printf("%s", my_strstr(ch,ch2));
}